function [C, S] = Generate_Data_Cyclic(n, m, p, q, Integer_True)

d = 2;

S = zeros(n*d,d);
for i = 1:n
    integer = Integer_True(i);
    S((i-1)*d+1:i*d,:) = [cos(2*pi*integer/m), -sin(2*pi*integer/m);...
                            sin(2*pi*integer/m), cos(2*pi*integer/m) ];
end
C = S * S';
for i = 1:n-1
    for j = (i+1):n
        if rand() > p
            C((i-1)*d+1:i*d,(j-1)*d+1:j*d) = 0;
            C((j-1)*d+1:j*d,(i-1)*d+1:i*d) = 0;
        else
            if rand() > q
                integer = randi(m);
                rand_S = [cos(2*pi*integer/m), -sin(2*pi*integer/m);...
                            sin(2*pi*integer/m), cos(2*pi*integer/m) ];
                C((i-1)*d+1:i*d,(j-1)*d+1:j*d) = rand_S;
                C((j-1)*d+1:j*d,(i-1)*d+1:i*d) = rand_S';
            end
        end
    end
end